<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

/**
 * 学生控制器
 */
class Student extends AdminBase
{
    
    /**
     * 学生列表
     */
    public function studentList()
    {
         $where = [];
        
        !empty($this->param['search_data']) && $where['username'] = ['like', (string)$this->param['search_data']];
        
        $this->assign('list', $this->logicStudent->getStudentList($where, true, 'username'));
        
        return $this->fetch('student_list');
        // $this->assign('list', $this->logicStudent->getStudentList());
        
        // return $this->fetch('student_list');
    }

    
     /**
     * 学生个人信息
     */
    public function studentsList()
    {
        
        $this->assign('list', $this->logicStudent->getStudentsList());
        
        return $this->fetch('student_list1');
    }


    /**
     * 学生添加
     */
    public function studentAdd()
    {
        
        IS_POST && $this->jump($this->logicStudent->studentEdit($this->param));
        
        return $this->fetch('student_edit');
    }
    
    /**
     * 学生编辑
     */
    public function studentEdit()
    {
        
        IS_POST && $this->jump($this->logicStudent->studentEdit($this->param));
        
        $info = $this->logicStudent->getStudentInfo(['id' => $this->param['id']]);
        
        $this->assign('info', $info);
        
        return $this->fetch('student_edit');
    }
    
    /**
     * 学生删除
     */
    public function studentDel($id = 0)
    {
        
        $this->jump($this->logicStudent->studentDel(['id' => $id]));
    }
}
